package cn.vastbase.jdbc.base;

import org.junit.Test;

import java.sql.*;

public class GetVersionTestCase {

    @Test
    public void getDriverVersion() {
        // 第一种方式
        Driver driver = new cn.com.vastbase.Driver();
        System.out.println(driver.getMajorVersion() + "." + driver.getMinorVersion());

        // 第二种方式
        String url = "jdbc:postgresql://192.168.56.12:5000/vastbase?loggerLevel=off";
        String username = "test";
        String password = "Vastdata#0730";
        try (Connection connection = DriverManager.getConnection(url, username, password);) {
            DatabaseMetaData databaseMetaData = connection.getMetaData();
            System.out.println(databaseMetaData.getDriverVersion());
        } catch (SQLException e) {
            System.err.println("SQL 异常：" + e.getMessage());
        }
    }
}
